<template>
  <div class="container">
    <div class="weui_cells_title">{{msg}}</div>
    <div class="weui_cells weui_cells_access ft-sm" style="margin-top:10px;">
      <div v-for="item in items" class="weui_cell">
        <div class="weui_cell_bd weui_cell_primary">
          <p>检查编号：<span class="am-ft-sm am-ft-blue">{{item.itemNo}}</span></p>
          <p>报告时间：<span class="am-ft-sm am-ft-blue">{{item.itemDate.substr(0,10)}}</span></p>
          <p>检查名称：<span class="am-ft-sm am-ft-blue">{{item.examItem}}</span></p>
          <p>影像所见：<span class="am-ft-sm am-ft-blue">{{item.report}}</span></p>
          <p>医生诊断：<span class="am-ft-sm am-ft-blue">{{item.conclusion}}</span></p>
        </div>
      </div>
    </div>
    <partial name="footer-copyright"></partial>
  </div>
</template>
<style scoped>
.ft-sm p {
  padding: 3px;
  font-size: 12px;
}

.blue_tag {
  background-color: #0ae;
  color: #fff;
  font-size: 13px;
  padding: 2px 4px;
  border: none;
  vertical-align: middle;
  -moz-border-radius: 3px;
  -webkit-border-radius: 3px;
  border-radius: 3px;
}

.orange_tag {
  background-color: #ff8208;
  color: #fff;
  font-size: 13px;
  padding: 2px 4px;
  border: none;
  vertical-align: middle;
  -moz-border-radius: 3px;
  -webkit-border-radius: 3px;
  border-radius: 3px;
}
</style>
<script>
import _ from 'underscore'

export default {
  name: 'GetCheckDetailView',
  data: function () {
    return {
      cardNo: -1,
      cardName: '',
      examType: '',
      appNo: '',
      appName: '',
      reportDate: '',
      items: [],
      msg: '检查单详情'
    }
  },
  ready: function () {
    this.cardNo = this.$route.query.cardNo
    this.cardName = this.$route.query.cardName
    this.examType = this.$route.query.examType
    this.appNo = this.$route.query.appNo
    this.appName = this.$route.query.appName
    this.reportDate = this.$route.query.reportDate
    this.getCheckItem()
  },
  methods: {
    getCheckItem: function () {
      if (this.cardNo === -1 || this.appNo === '') {
        return
      }

      var self = this

      this.$ajax.get('GetReportDetail', 'Report', {
        cardNo: this.cardNo,
        cardName: this.cardName,
        examType: this.examType,
        examId: this.appNo
      }).then(function (data) {
        if (data.ResultCode !== '0') {
          self.msg = data.ResultMsg
          self.items = []
        } else {
          self.items = _.map(data.ResultData, function (val) {
            return {
              itemNo: val.ExamId,
              itemDate: val.ReportDate,
              examItem: val.ExamItem,
              report: val.Report,
              conclusion: val.Conclusion
            }
          })
          self.msg = '检查单详情'
          if (self.items.length <= 0) {
            self.msg = '找不到检查单详情'
            self.items = []
          }
        }
      })
    }
  }
}
</script>
